package com.phiture.erp.purchase.core.service;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import com.phiture.erp.purchase.core.pojo.vo.ErpPurchaseRequestItemPushVO;
import com.phiture.erp.purchase.core.pojo.vo.ErpPurchaseRequestPageReqVO;
import com.phiture.erp.purchase.core.pojo.vo.ErpPurchaseRequestRespVO;
import com.phiture.erp.purchase.core.pojo.vo.ErpPurchaseRequestSaveReqVO;
import com.phiture.erp.purchase.dal.entity.ErpPurchaseRequestDO;
import com.phiture.erp.purchase.dal.entity.ErpPurchaseRequestItemsDO;

import javax.validation.*;
import java.util.List;

/**
 * 采购申请单 Service 接口
 *
 * @author lekaihuai
 */
public interface ErpPurchaseRequestService {

    /**
     * 创建采购申请单
     *
     * @param createReqVO 创建信息
     * @return 编号
     */
    Long createPurchaseRequest(@Valid ErpPurchaseRequestSaveReqVO createReqVO);

    /**
     * 更新采购申请单
     *
     * @param updateReqVO 更新信息
     */
    void updatePurchaseRequest(@Valid ErpPurchaseRequestSaveReqVO updateReqVO);

    /**
     * 更新采购申请单的状态
     * @param id
     * @param status
     */
    void updatePurchaseRequestStatus(Long id, Integer status);

    /**
     * 删除采购申请单
     *
     * @param id 编号
     */
    void deletePurchaseRequest(Long id);

    /**
     * 获得采购申请单
     *
     * @param id 编号
     * @return 采购申请单
     */
    ErpPurchaseRequestDO getPurchaseRequest(Long id);

    /**
     * 获得采购申请单分页
     *
     * @param pageReqVO 分页查询
     * @return 采购申请单分页
     */
    PageResult<ErpPurchaseRequestRespVO> getPurchaseRequestPage(ErpPurchaseRequestPageReqVO pageReqVO);

    // ==================== 子表（采购申请单明细） ====================

    /**
     * 获得采购申请单明细列表
     *
     * @param requestId 申请单ID
     * @return 采购申请单明细列表
     */
    List<ErpPurchaseRequestItemsDO> getPurchaseRequestItemsListByRequestId(Long requestId);

    int updatePurchaseRequestItem(ErpPurchaseRequestItemsDO item);

    List<ErpPurchaseRequestItemsDO> getPurchaseRequestItemsListByRequestIds( List<ErpPurchaseRequestItemPushVO> requestIds);

    ErpPurchaseRequestItemsDO getPurchaseRequestItemsListBId(Long id);

    void savePurchaseRequest(ErpPurchaseRequestDO requestDO);
    void savePurchaseRequestItem(ErpPurchaseRequestItemsDO requestItemsDO);
}